Unit Abilities;

{$mode objfpc}{$H+}

Interface

Uses
  Crt,
  Initializer,
  DefaultClasses,
  MenuDraw;

Var
  AbilityDamage : Integer;
  AbilityChoice : Char;
  Hit : Boolean;

Procedure WarriorList(Level : Integer; Var Rage : Integer);
Procedure MageList(Level : Integer; Var Mana : Integer);
Procedure ArcherList(Level : Integer; Var Energy : Integer);

Implementation

Procedure WarriorList(Level : Integer; Var Rage : Integer);
 Begin
   Hit := False;
   If Level >= 1 then
     Writeln('1. ',WarriorBank[1],' - 20 Rage');
   If Level >= 3 then
     Writeln('2. ',WarriorBank[2],' - 25 Rage');
   If Level >= 5 then
     Writeln('3. ',WarriorBank[3],' - 45 Rage');
   If Level >= 7 then
     Writeln('4. ',WarriorBank[4],' - 60 Rage');
   If Level >= 9 then
     Writeln('5. ',WarriorBank[5],' - 85 Rage');
   If Level >= 10 then
     Writeln('6. ',WarriorBank[6],' - 100 Rage');
   Repeat
     AbilityChoice := Readkey;
     Case AbilityChoice of
       #49 : Begin
               If (Level >= 1) and (Rage >= 10) then
                 Begin
                   AbilityDamage := 30 + Strength;
                   Rage := Rage - 10;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Rage');
                       Attention;
                     end;
             end;

       #50 : Begin
               If (Level >= 3) and (Rage >= 20) then
                 Begin
                   AbilityDamage := 40 + Strength;
                   Rage := Rage - 20;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Rage');
                       Attention;
                     end;
             end;

       #51 :  Begin
               If (Level >= 5) and (Rage >= 45) then
                 Begin
                   AbilityDamage := 50 + Strength;
                   Rage := Rage - 35;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Rage');
                       Attention;
                     end;
             end;

       #52 :  Begin
               If (Level >= 7) and (Rage >= 40) then
                 Begin
                   AbilityDamage := 75 + Strength;
                   Rage := Rage - 40;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Rage');
                       Attention;
             end;

       end;

       #53 :  Begin
               If (Level >= 9) and (Rage >= 60) then
                 Begin
                   AbilityDamage := 100 + Strength;
                   Rage := Rage - 60;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Rage');
                       Attention;
             end;

       end;

       #54 :  Begin
               If (Level >= 10) and (Rage >= 85) then
                 Begin
                   AbilityDamage := 200 + Strength;
                   Rage := Rage - 85;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Rage');
                       Attention;
             end;

       end;
     end;

   Until (AbilityChoice >= #49) and (AbilityChoice <= #54);
 end;

Procedure MageList(Level : Integer; Var Mana : Integer);
 Begin
   Hit := False;
   If Level >= 1 then
     Writeln('1. ',MageBank[1]);
   If Level >= 3 then
     Writeln('2. ',MageBank[2]);
   If Level >= 5 then
     Writeln('3. ',MageBank[3]);
   If Level >= 7 then
     Writeln('4. ',MageBank[4]);
   If Level >= 9 then
     Writeln('5. ',MageBank[5]);
   If Level >= 10 then
     Writeln('6. ',MageBank[6]);

   Repeat
     AbilityChoice := Readkey;
     Case AbilityChoice of
       #49 : Begin
               If (Level >= 1) and (Mana >= 20) then
                 Begin
                   AbilityDamage := 30;
                   Mana := Mana - 20;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Mana');
                       Attention;
                     end;
             end;

       #50 : Begin
               If (Level >= 3) and (Mana >= 25) then
                 Begin
                   AbilityDamage := 40;
                   Mana := Mana - 25;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Mana');
                       Attention;
                     end;
             end;

       #51 :  Begin
               If (Level >= 5) and (Mana >= 45) then
                 Begin
                   AbilityDamage := 50;
                   Mana := Mana - 45;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Mana');
                       Attention;
                     end;
             end;

       #52 :  Begin
               If (Level >= 7) and (Mana >= 60) then
                 Begin
                   AbilityDamage := 70;
                   Mana := Mana - 60;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Mana');
                       Attention;
                     end;
             end;

       #53 :  Begin
               If (Level >= 9) and (Mana >= 85) then
                 Begin
                   AbilityDamage := 100;
                   Mana := Mana - 85;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Mana');
                       Attention;
                     end;
             end;

       #54 :  Begin
               If (Level >= 10) and (Mana >= 300) then
                 Begin
                   AbilityDamage := 200;
                   Mana := Mana - 100;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Mana');
                       Attention;
                     end;
             end;
     end;

   Until (AbilityChoice >= #49) and (AbilityChoice <= #54);

 end;

Procedure ArcherList(Level : Integer; Var Energy : Integer);
 Begin
   Hit := False;
   If Level >= 1 then
     Writeln('1. ',ArcherBank[1]);
   If Level >= 3 then
     Writeln('2. ',ArcherBank[2]);
   If Level >= 5 then
     Writeln('3. ',ArcherBank[3]);
   If Level >= 7 then
     Writeln('4. ',ArcherBank[4]);
   If Level >= 9 then
     Writeln('5. ',ArcherBank[5]);
   If Level >= 10 then
     Writeln('6. ',ArcherBank[6]);

   Repeat
     AbilityChoice := Readkey;
     Case AbilityChoice of
       #49 : Begin
               If (Level >= 1) and (Energy >= 20) then
                 Begin
                   AbilityDamage := 30;
                   Energy := Energy - 20;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Energy');
                       Attention;
             end;

       end;

       #50 : Begin
               If (Level >= 3) and (Energy >= 25) then
                 Begin
                   AbilityDamage := 40;
                   Energy := Energy - 25;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Energy');
                       Attention;
             end;

       end;

       #51 :  Begin
               If (Level >= 5) and (Energy >= 35) then
                 Begin
                   AbilityDamage := 55;
                   Energy := Energy - 35;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Energy');
                       Attention;
             end;

       end;

       #52 :  Begin
               If (Level >= 7) and (Energy >= 50) then
                 Begin
                   AbilityDamage := 75;
                   Energy := Energy - 50;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Energy');
                       Attention;
             end;

       end;

       #53 :  Begin
               If (Level >= 9) and (Energy >= 70) then
                 Begin
                   AbilityDamage := 100;
                   Energy := Energy - 70;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Energy');
                       Attention;
             end;

       end;

       #54 :  Begin
               If (Level >= 10) and (Energy >= 100) then
                 Begin
                   AbilityDamage := 250;
                   Energy := Energy - 90;
                   Hit := True;
                   end else
                     Begin
                       Writeln('Not Enough Energy');
                       Attention;
             end;

       end;
     end;

   Until (AbilityChoice >= #49) and (AbilityChoice <= #54);
 end;

end.

